﻿@model WarOfDev.EF.Post

@{
    ViewBag.Title = "Details";
}

<h2>Cate Detail</h2>

<table>
    <tr>
        <th> @Html.DisplayNameFor(model => model.Title)</th>
        <td>  @Html.DisplayFor(model => model.Title)
        </td>
    </tr>

    <tr>
        <th> @Html.DisplayNameFor(model => model.Content)</th>
        <td class="content">  @Html.DisplayFor(model => model.Content)</td>
    </tr>
    <tr>
        <th>@Html.DisplayNameFor(model => model.Tags)</th>
        <td>  @Html.DisplayFor(model => model.Tags)</td>
    </tr>
    <tr>
        <th> @Html.DisplayNameFor(model => model.CreatedBy)</th>
        <td> @Html.DisplayFor(model => model.Developer.NickName)</td>
    </tr>
    <tr>
        <th> @Html.DisplayNameFor(model => model.CreatedOn)
    </div></th>
        <td>@Model.CreatedOn.Value.ToString("yyyy-MM-dd hh:mm:ss")</td>
    </tr>
</table>



    <table>
    @foreach (var comment in Model.Comments)
    {
        <tr>
            <td>
                @WarOfDev.Core.Configuration.DefaultExperienceValueSetting.StartRatingList.SingleOrDefault(i=>i.Value==comment.ExperienceValue.ToString()).Text
            </td>
            <td>
                @comment.Commend           
            </td>
        </tr>
    }
    </table>

@if (ViewBag.currentDeveloperId != Model.CreatedBy)
{
    <h2>Comments</h2>
    using (Html.BeginForm("Comment", "Cate"))
    {
        @Html.Hidden("cateId", Model.Id)
        @Html.DropDownList("startRating", WarOfDev.Core.Configuration.DefaultExperienceValueSetting.StartRatingList)
        @Html.TextArea("anwser", new { rows = 10, cols = 50 });
        <p>
            <input type="submit" value="Post Your Comment " />
        </p>
    }
}

<p>
   @if (ViewBag.currentDeveloperId == Model.CreatedBy)
   {
        @Html.ActionLink("Edit", "Edit", new { id=Model.Id }) 
   }
    @Html.ActionLink("Back to List", "Index")
</p>
